package com.cljz.makepassenger.ui.ItemDecoration;

import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;

/**
 * Created by apple on 2017/4/10.
 */

public class LinearSpacesItemDecoration extends RecyclerView.ItemDecoration {
    private int space;

    public LinearSpacesItemDecoration(int space) {
        this.space = space;
    }

    @Override
    public void getItemOffsets(Rect outRect, View view,
                               RecyclerView parent, RecyclerView.State state) {
        outRect.bottom = space;
        // Add top margin only for the first item to avoid double space between items
//        if ((parent.getChildPosition(view) + 1) % 4 != 0) {
//            outRect.right = space;
//
//        }
    }
}
